package de.fhaugsburg.games.boardgames.tests;


import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

import de.fhaugsburg.games.boardgames.GridPoint;

public class GridPointTest {
	GridPoint point1;
	GridPoint point2;
	GridPoint point3;
	GridPoint point4;
	Set<GridPoint> pointSet;

	@Before
	public void setUp() throws Exception {
		point1 = new GridPoint(1,1);
		point2 = new GridPoint(-1,-1);
		point3 = new GridPoint(1,1);
		point4 = new GridPoint(5,2);
		pointSet = new HashSet<GridPoint>();
		pointSet.add(new GridPoint(1,3));
		pointSet.add(new GridPoint(1,0));
		pointSet.add(new GridPoint(1,5));
		
	}
	
	@Test 
	public void testEqual(){
		assertEquals(point1, point3);
	}
	
	@Test
	public void testClone(){
		assertEquals(point1, point1.clone());
	}
	
	@Test
	public void testNeg(){
		assertEquals(point2, point1.neg());
	}
	
	@Test
	public void testPlus(){
		assertEquals(new GridPoint(0,0), point1.add(point2));
	}
	
	@Test
	public void testMinus(){
		assertEquals(new GridPoint(4,1),point4.minus(point1) );
	}
	
	@Test
	public void testIsManhattanColinearWith(){
		assertTrue(point1.isManhattancolinearWith(pointSet));
	}
	
	

}
